package com.spzx.cart.api;

import com.spzx.cart.api.domain.CartInfo;
import com.spzx.cart.api.impl.RemoteCartServiceFallback;
import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

@FeignClient(value = ServiceNameConstants.CART_SERVICE, fallback = RemoteCartServiceFallback.class)
public interface RemoteCartService {

    @Operation(summary = "查询用户购物车列表中选中商品列表")
    @GetMapping("/getCartCheckedList")
    public R<List<CartInfo>> getCartCheckedList(@RequestHeader(SecurityConstants.FROM_SOURCE) String header);


    @Operation(summary="更新用户购物车列表价格")
    @GetMapping("/updateCartPrice/{userId}")
    public R<Boolean> updateCartPrice(@PathVariable(value = "userId",required = false) Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String header);


    @Operation(summary="删除用户购物车列表中选中商品列表")
    @GetMapping("/deleteCartCheckedList/{userId}")
    public R<Boolean> deleteCartCheckedList(@PathVariable(value = "userId", required = false) Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String header);
}
